package com.cmnit.analysis.service

import com.cmnit.analysis.dao.BroadcastDao
import com.cmnit.analysis.util.EnvUtil
import org.apache.log4j.Logger


class BroadcastService {

  private val logger: Logger = Logger.getLogger(this.getClass)
  private val dao = new BroadcastDao

  def stationInfoBroadcast(): Unit = {
    println("广播收费站码表")
    EnvUtil.take().sparkContext.broadcast(dao.stationInfoBroadcast()).value.createOrReplaceTempView("tmp_station_info")
  }

  def gantryBroadcast(): Unit = {
    println("广播门架中间表")
    EnvUtil.take().sparkContext.broadcast(dao.gantryBroadcast()).value.createOrReplaceTempView("tmp_organization_gantry")
  }

  def laneBroadcast(): Unit = {
    println("广播车道中间表")
    EnvUtil.take().sparkContext.broadcast(dao.laneBroadcast()).value.createOrReplaceTempView("tmp_organization_lane")
  }

  def gantryInfoBroadcast(): Unit = {
    println("广播门架信息表")
    EnvUtil.take().sparkContext.broadcast(dao.gantryInfoBroadcast()).value.createOrReplaceTempView("tmp_organization_gantryinfo")
  }

  def vehicleBasicBroadcast(): Unit = {
    println("广播车牌-车辆类型码表")
    EnvUtil.take().sparkContext.broadcast(dao.vehicleBasicBroadcast()).value.createOrReplaceTempView("tmp_tbl_vehiclebasicinfo")
  }

}
